package com.szl.demo.controller;

import com.alibaba.fastjson.JSONObject;
import com.szl.demo.domain.WordCount;
import com.szl.demo.service.SparkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description TODO
 * @Author xt
 * @Date 2019/10/25 0025
 * @Version 1.0
 **/
@RestController
public class Controller {

    @Autowired
    private SparkService sparkService;

    @GetMapping("/wordCount")
    public String wordCount() {
        List<WordCount> list = sparkService.doWordCount();
        return JSONObject.toJSONString(list);
    }

}
